<?php
$code = $code==0?500:$code;

$msg = "<p class='errorMessage'>". htmlentities($message) ."</p>";

if( strpos($msg,'SQLSTATE')!== false){
  $lastSQL = think\Db::getLastSql();
  $msg.= "<p class='errorMessage'>SQL语句：". $lastSQL ."</p>";
}

if(config('app_debug')){
  $str = "";
  foreach( $trace as $kerr=>$verr){
    $foc = $verr['file']?$verr['file']:$verr['class'] ;
    $str.= "<p  class = 'errorMessage'>$kerr : ". $foc ." [line ".$verr['line']."]  ==> ".$verr['function']." </p>";
  }
  $msg.= $str;

}

?>
<!-- common/tpl/exception_tmpl.html -->
<!DOCTYPE html>
<html mip>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <link rel="stylesheet" type="text/css" href="https://mipcache.bdstatic.com/static/v1/mip.css">
    <title>请求出现了[code:<?php echo $code?>]异常</title>
    <link rel="canonical" href="<?php echo config('mipInfo')['domain']; ?>">
    <style mip-custom>
        .page {
            width: 100%;
            margin: 0 auto;
            text-align: center;
            padding-top: 5vw;
        }
        .page span{
            font-size: 40px;
            text-align: center;
            color: #d4d4d4;
        }
        .page p{
            margin-bottom: 15px;
            font-size: 14px;
            color: #aaa;
        }
        .page .errorMessage1 {
            width: 1000px;
            margin: 30px auto;
            text-align: left;
            font-size: 20px;
        }
        .page .errorMessage {
            width: 1000px;
            padding-left: 4em;
            margin: 10px auto;
            text-align: left;
            font-size: 16px;

        }
        .page a{
            color: #aaa;
        }
    </style>
</head>
<body>
<div class="page">
    <span>请求异常</span>
    <p class="errorMessage1">原因：</p>
    <?php echo $msg; ?>
    <p>&nbsp; </p>
    <p>Copyright &copy; Powered By <a data-type='mip' href="http://www.pingbuwang.com" data-title="平步CMS内容管理系统" target="_blank">平步CMS内容管理系统!</a></p>
</div>
<script src="https://mipcache.bdstatic.com/static/v1/mip.js"></script>
</body>
</html>